<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>动画实现步骤</title>
    <style>
      .box {
        width: 200px;
        height: 100px;
        background-color: pink;
      }
      .boxMax {
        width: 200px;
        height: 100px;
        background-color: skyblue;
      }

      .box:hover {
        animation: widthChange 2s;
      }
      .boxMax:hover {
        animation: widthChangeMax 5s;
      }
      /* 动画一：宽度从200变化到800 */

      @keyframes widthChange {
        from {
          width: 200px;
        }
        to {
          width: 800px;
        }
      }

      /* 动画二：从 200*100 变化到 300*300 变化到800*500 */
      @keyframes widthChangeMax {
        0% {
          width: 200px;
          height: 100px;
        }
        30% {
          width: 300px;
          height: 300px;
        }
        70% {
          width: 800px;
          height: 300px;
        }
        100% {
          width: 800px;
          height: 500px;
        }
      }
    </style>
  </head>

  <body>
    <div class="box"></div>
    <div class="boxMax"></div>
  </body>
</html>
